package co.edu.unal.geditor.view.controlpoints;

import java.awt.Cursor;
import java.awt.Point;

import co.edu.unal.geditor.controller.App;
import co.edu.unal.geditor.model.BoundBox;

public class DownControlPoint extends ControlPoint {
	public DownControlPoint(){
		
	}
	public DownControlPoint(Point point, int ControlPointDimension) {
		super(point, ControlPointDimension);
	}
	public DownControlPoint(Point point) {
		super(point);
	}

	@Override
	public void changeCursor() {
		App.getInstance().getCanvas().setCursor(new Cursor(Cursor.S_RESIZE_CURSOR));
	}
	@Override
	public void resizing(Point cursorPosition, BoundBox modifiedBoundBox) {
		
		if (cursorPosition.y>modifiedBoundBox.getLeftUp().y) {
			modifiedBoundBox.setRightDown(new Point(modifiedBoundBox.getRightDown().x,cursorPosition.y));
			
		}
		else
		{
			/*if (cursorPosition.y==modifiedBoundBox.getLeftUp().y && !deformed){
				modifiedBoundBox.setRightDown(new Point(modifiedBoundBox.getRightDown().x,modifiedBoundBox.getLeftUp().y));
				deformed=true;
			}
			modifiedBoundBox.setLeftUp(new Point(modifiedBoundBox.getLeftUp().x,cursorPosition.y));*/
			
		}
		
	}
	boolean deformed=false;

}
